#ifndef __PROTO_H__
#define __PROTO_H__
#include <site_type.h>

#define DEFAULE_MGROUP "224.2.2.2"
#define DEFAULT_RCVPORT "1989"
#define CHNNR (100)
#define LISTCHNNID (0)
#define MINCHNID (1)
#define MAXCHNID (MINCHNID + CHNNR -1)
#define MSG_CHANNEL_MAX (65536 -20 -8) //UDP推荐长度512，这里取65536。20是ip包头长度，8是UDP包头长度
#define MAX_DATA (MSG_CHANNEL_MAX - sizeof(chnid_t))
#define MSG_LIST_MAX (65536 -20 -8)
#define MAX_ENTRY (MSG_LIST_MAX - sizeof(chnid_t))

struct msg_channel_st{
    chnid_t chnid; /* 取值范围[MINCHNID, MAXCHNID] */
    uint8_t data[1]; //使之变长
}__attribute__((packed));

//1 music:xxxxx
//2 sport:xxxx
//3 xxxxx:xxx
struct msg_listentry_st{
    chnid_t chnid; /* 取值范围[MINCHNID, MAXCHNID] */
    uint16_t len;
    uint8_t desc[1]; //使之变长
}__attribute__((packed));

struct msg_list_st{
    chnid_t chnid; /* 取值范围[LISTCHNNID] */
    struct msg_listentry_st entry[1]; //使之变长
}__attribute__((packed));

#endif //__PROTO_H__
